﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace BoriPeter.FatSecret.Models
{

        [XmlRoot("food", Namespace = "http://platform.fatsecret.com/api/1.0/")]
        public class FoodGetModel
        {
            /* the unique food identifier. */
            [XmlElement("food_id")]
            public int FoodId { get; set; }

            /* the name of the food, not including the brand name. E.G.: "Instant Oatmeal". */
            [XmlElement("food_name")]
            public string FoodName { get; set; }

            /* takes the value "Brand" or "Generic". Indicates whether the food is a brand or generic item */
            [XmlElement("food_type")]
            public string FoodType { get; set; }

            /* URL of this food item on www.fatsecret.com. */
            [XmlElement("food_url")]
            public string FoodUrl { get; set; }

            [XmlArray(ElementName = "servings")]
            [XmlArrayItem(ElementName = "serving")]
            public List<FoodGetServing> Servings { get; set; }
        }

        public class FoodGetServing
        {
            /*************************************************************************************/
            /* Nutrient values for each food item are returned according to the standard serving */
            /* sizes available. The elements returned for each standard serving size are:        */
            /*************************************************************************************/

            /* the unique serving identifier. */
            [XmlElement("serving_id")]
            public int ServingId { get; set; }

            /*  the full description of the serving size. E.G.: "1 cup" or "100 g". */
            [XmlElement("serving_description")]
            public string ServingDescription { get; set; }

            /* URL of the serving size for this food item on www.fatsecret.com. */
            [XmlElement("serving_url")]
            public string ServingUrl { get; set; }

            /* is a Decimal - the metric quantity combined with metric_serving_unit 
             * to derive the total standardized quantity of the serving (where available). */
            [XmlElement("metric_serving_amount")]
            public decimal MetricServingAmount { get; set; }

            /* the metric unit of measure for the serving size – either "g" or "ml" or "oz" – 
             * combined with metric_serving_amount to derive the total standardized 
             * quantity of the serving (where available). */
            [XmlElement("metric_serving_unit")]
            public string MetricServingUnit { get; set; }

            /* is a Decimal - the number of units in this standard serving size. 
             * For instance, if the serving description is "2 tablespoons" the number 
             * of units is "2", while if the serving size is "1 cup" the number of units is "1". */
            [XmlElement("number_of_units")]
            public decimal NumberOfUnits { get; set; }

            /* a description of the unit of measure used in the serving description. 
             * For instance, if the description is "1/2 cup" the measurement description 
             * is "cup", while if the serving size is "100 g" the measurement description is "g". */
            [XmlElement("measurement_description")]
            public string MeasurementDescription { get; set; }

            /*************************************************************************************/
            /* The complete nutritional information is returned - see nutrient                   */
            /*************************************************************************************/

            /* is a Decimal – the energy content in kcal. */
            [XmlElement("calories")]
            public decimal Calories { get; set; }

            /* is a Decimal – the total carbohydrate content in grams. */
            [XmlElement("carbohydrate")]
            public decimal Carbohydrate { get; set; }

            /* is a Decimal – the protein content in grams. */
            [XmlElement("protein")]
            public decimal Protein { get; set; }

            /* is a Decimal – the total fat content in grams. */
            [XmlElement("fat")]
            public decimal Fat { get; set; }

            /* is a Decimal – the saturated fat content in grams (where available). */
            [XmlElement("saturated_fat")]
            public decimal SaturatedFat { get; set; }

            /* is a Decimal – the polyunsaturated fat content in grams (where available). */
            [XmlElement("polyunsaturated_fat")]
            public decimal PolyunsaturatedFat { get; set; }

            /* is a Decimal – the monounsaturated fat content in grams (where available). */
            [XmlElement("monounsaturated_fat")]
            public decimal MonounsaturatedFat { get; set; }

            /* is a Decimal – the trans fat content in grams (where available). */
            [XmlElement("trans_fat")]
            public decimal TransFat { get; set; }

            /* is a Decimal – the cholesterol content in milligrams (where available). */
            [XmlElement("cholesterol")]
            public decimal Cholesterol { get; set; }

            /* is a Decimal – the sodium content in milligrams (where available). */
            [XmlElement("sodium")]
            public decimal Sodium { get; set; }

            /* is a Decimal – the potassium content in milligrams (where available). */
            [XmlElement("potassium")]
            public decimal Potassium { get; set; }

            /* is a Decimal – the fiber content in grams (where available). */
            [XmlElement("fiber")]
            public decimal Fiber { get; set; }

            /* sugar is a Decimal – the sugar content in grams (where available). */
            [XmlElement("sugar")]
            public decimal Sugar { get; set; }

            /* is a Decimal – the sugar content in grams (where available). */
            [XmlElement("vitamin_a")]
            public int VitaminA { get; set; }

            /* is an Int – the percentage of daily recommended Vitamin C, based on a 2000 calorie diet (where available). */
            [XmlElement("vitamin_c")]
            public int VitaminC { get; set; }

            /* is an Int – the percentage of daily recommended Calcium, based on a 2000 calorie diet (where available). */
            [XmlElement("calcium")]
            public int Calcium { get; set; }

            /* is an Int – the percentage of daily recommended Iron, based on a 2000 calorie diet (where available). */
            [XmlElement("iron")]
            public int Iron { get; set; }
        }
}
